<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>零件追溯评价管理系统</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script src="resources/jslib/jquery.js" type="text/javascript"></script>
	<link href="resources/css/style.css" rel="stylesheet" type="text/css" />
  </head>
  		<script  type="text/javascript">
	$(function() {
		//居中
		document.getElementById("username").focus();
		$("#username").keydown(function(event) {
			if (event.keyCode == 13) {
				login();
			}
		});
		$("#password").keydown(function(event) {
			if (event.keyCode == 13) {
				login();
			}
		});

	});
	
	function setUser(){
		
	}

	//登录
	function login() {
		$("#mes").show();
		$("#mes").html("&nbsp;&nbsp;正在登录中...");
		//登录处理
		var param={"password":$("#password").val(),"userName":$("#username").val()};
		$.ajax({
			type: "post",
			contentType: "application/json;charset=utf-8",
			url : "index/finishLogin",
			data :JSON.stringify(param) ,
			success : function(data){
                       if(data.code=="0000"){
                          window.location="main/index"; 
                       }else{
                          $("#mes").html(data.code+"##"+data.message);
                        }
                      
             },
			 dataType : "json"
		});
	}
</script>
  <body style="background:url(resources/images/login_bg.gif) repeat-x; margin: 0 auto" onload="setUser()">
	<div class="login_main">
		<div class="login_u"><img src="resources/images/logo_d.jpg" style="margin-left: 60px" /></div>
		
		<div class="login_in">
			<div class="login_title"></div>
			<form  class="cmxform" method="post" name="form1" 
			id="loginForm" 
						>
			    <div class="fi">
					<label class="lb">用户名</label>
					<input type="text" class="ipt-t no-ime" id="username" name="username" tabindex="2">
			    </div>
			    <div class="fi">
					<label class="lb">密　码</label>
					<input type="password" maxlength="20" id="password" name="password" class="ipt-t no-ime" tabindex="3">
				</div>
				
				<div class="fi fi_jig">
					<input type="checkbox" class="ipt-c" tabindex="4" name="usercheck" checked="checked">记住用户名和密码
				</div>
				<div class="fi fi-btn">
					<input type="button" value="登　录" class="ipt-b" tabindex="5" onclick="login()">
				</div>
				<div style="color:#F00" class="fi fi_jig" id="mes"></div>
			</form>
		</div>		
		<div class="clear"></div>
	</div>
</body>
</html>
